﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using Axis.Web.Administrator.Global;
using Axis.Dao.Research;
using Axis.BusinessObject.Research;
using System.Text;
using System.Web.Script.Serialization;
using Axis.BusinessObject.Core;
namespace Axis.Web.Views.Research
{
    public partial class ResearchDetail : System.Web.UI.Page
    {
        ResearchUI projectUI = new ResearchUI();
        private CQuestionUI questionUI = new CQuestionUI();
        protected void Page_Load(object sender, EventArgs e)
        {
            string ProjectID = "";
            if (Request.QueryString["ID"] != null)
                ProjectID = Request.QueryString["ID"].ToString();
            GetProjectByID(ProjectID);
        }
       
        protected void GetProjectByID(string projectID)
        {
            var member = new CMemberList();
            if (Session["MEMBERINFO"] != null)
                member = Session["MEMBERINFO"] as CMemberList;
            XmlDocument doc = new XmlDocument();
            XmlElement root = doc.CreateElement("InputValue");
            doc.AppendChild(root);
            root.SetAttribute("UserID", member.ID.ToString());
            root.SetAttribute("SecrectToken", member.SecrectToken);
            root.SetAttribute("Context", "AvailableProject");
            root.SetAttribute("Type", "1");
            root.SetAttribute("Action", "GET");
            root.SetAttribute("PageIndex", "1");
            root.SetAttribute("RowsPerPage", "1");
            root.SetAttribute("ID", projectID);
            CResearchDao core = new CResearchDao();
            CCore cCore = new CCore();
            string inputValue = root.OuterXml;

            IList<CProject> list = new CResearchDao().GetProject(inputValue);
            if (list != null && list.Count > 0)
            {
                string script = string.Format("var __Project={0};", new JavaScriptSerializer().Serialize(list));
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "Project_JS", script, true);
            }

        }
    }
}